﻿using System.Globalization;
using Contact = ValueConverter.Models.Contact;

namespace ValueConverter.Converters;

public class ContactToNameConverter : IValueConverter {
    public object Convert(object value, Type targetType, object parameter,
        CultureInfo culture) {
        return value is Contact contact
            ? $"{contact.FirstName} {contact.LastName}"
            : "";
    }

    public object ConvertBack(object value, Type targetType, object parameter,
        CultureInfo culture) {
        throw new NotImplementedException();
    }
}